package com.jinmdz.fmis.mapper.mapper;

import com.jinmdz.fmis.mapper.entity.BusinessSystemMenuButtonEntity;
import com.jinmdz.fmis.mapper.mapper.provider.BusinessSystemMenuButtonProvider;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

/**
 * 业务系统菜单按钮Mapper
 *
 * @author generator
 * @date 2020-03-18 15:10
 */
public interface BusinessSystemMenuButtonMapper {

    /**
     * 增加BusinessSystemMenuButton
     *
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-03-18 15:10
     */
    @InsertProvider(type = BusinessSystemMenuButtonProvider.class, method = "insertBusinessSystemMenuButton")
    @Options(useGeneratedKeys = true, keyProperty = "entity.id", keyColumn = "id")
    void insertBusinessSystemMenuButton(@Param("entity") BusinessSystemMenuButtonEntity entity);

    /**
     * 删除BusinessSystemMenuButton
     *
     * @param id             主键
     * @param modifiedUserId 修改用户外键
     * @param version        版本号
     * @return
     * @author generator
     * @date 2020-03-18 15:10
     */
    @Update(" update business_system_menu_button set deleted = 1,modified_user_id = #{modifiedUserId},version = unix_timestamp(now()) where id = #{id} and version = #{version} and unmodified = 0 and deleted = 0 ")
    void deletedForBusinessSystemMenuButton(@Param("id") Integer id, @Param("modifiedUserId") Integer modifiedUserId, @Param("version") Long version);

    /**
     * 修改BusinessSystemMenuButton
     *
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-03-18 15:10
     */
    @UpdateProvider(type = BusinessSystemMenuButtonProvider.class, method = "updateBusinessSystemMenuButton")
    void updateBusinessSystemMenuButton(@Param("entity") BusinessSystemMenuButtonEntity entity);

    /**
     * 查询BusinessSystemMenuButton实体
     *
     * @param id 主键
     * @return BusinessSystemMenuButtonEntity
     * @author generator
     * @date 2020-03-18 15:10
     */
    @Select(" select id,deleted,business_system_menu_id,button_name,button_describe,disable_state,sort,remark,funeral_parlour_code,create_user_id,gmt_create,unmodified,modified_user_id,gmt_modified,version from business_system_menu_button where id = #{id} and deleted = 0 limit 1 ")
    BusinessSystemMenuButtonEntity getBusinessSystemMenuButtonById(@Param("id") Integer id);

    /**
     * 查询BusinessSystemMenuButton列表
     *
     * @param entity 数据实体
     * @return BusinessSystemMenuButtonEntity
     * @author generator
     * @date 2020-03-18 15:10
     */
    @SelectProvider(type = BusinessSystemMenuButtonProvider.class, method = "listBusinessSystemMenuButton")
    ArrayList<BusinessSystemMenuButtonEntity> listBusinessSystemMenuButton(@Param("entity") BusinessSystemMenuButtonEntity entity);
}